package org.liveboardgames.agricola.control.delegates.mock.cards.actioncards
{
    import org.liveboardgames.agricola.control.delegates.mock.ActionFactory;
    import org.liveboardgames.agricola.model.enums.ActionOutputEnum;
    import org.liveboardgames.agricola.model.enums.ResourceZoneEnum;
    import org.liveboardgames.agricola.view.component.ImageHandler;
    import org.liveboardgames.agricola.vo.action.Action;
    import org.liveboardgames.agricola.vo.card.ActionCard;
    
    import mx.collections.ArrayCollection;
    import mx.collections.ListCollectionView;
    
    [Bindable]
    public class ThreePlayersFamilyCards
    {
        public static const ONE_BUID_MATERIAL:ActionCard = getOneBuildMatCard();
        
        public static const ONE_CLAY:ActionCard = getOneClayCard();
        
        public static const TWO_BUID_MATERIAL:ActionCard = getTwoBuildMatCard();
        
        public static const TWO_WOOD:ActionCard = getTwoWoodCard();
        
        private static function getOneBuildMatCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "One building material";
            card.imagePath = ImageHandler.THREE_PLAYERS_FAMILY + "OneBuildingMaterial.png";
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.CHOICE_RESOURCE, 1);
            actions.addItem(action);
            card.actions = actions;
            
            return card;
        }
        
        private static function getOneClayCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "One clay";
            card.imagePath = ImageHandler.THREE_PLAYERS_FAMILY + "OneClay.png";
            card.resourceZone = ResourceZoneEnum.BOTTOM;
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            
            // Accumulation of resources
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.CLAY, 1, true);
            action.target = card;
            action.needPlayerInput = false;
            
            // A peep can take all accumulated resources
            var takeAction:Action = ActionFactory.getTakeAllAction(card);
            
            actions.addItem(action);
            actions.addItem(takeAction);
            card.actions = actions;
            
            return card;
        }
        
        private static function getTwoBuildMatCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "Two building materials";
            card.imagePath = ImageHandler.THREE_PLAYERS_FAMILY + "TwoBuildingMaterial.png";
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.CHOICE_RESOURCE, 2);
            actions.addItem(action);
            card.actions = actions;
            
            return card;
        }
        
        private static function getTwoWoodCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "Two woods";
            card.imagePath = ImageHandler.THREE_PLAYERS_FAMILY + "TwoWood.png";
            card.resourceZone = ResourceZoneEnum.BOTTOM;
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            
            // Accumulation of resources
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.WOOD, 2, true);
            action.target = card;
            action.needPlayerInput = false;
            
            // A peep can take all accumulated resources
            var takeAction:Action = ActionFactory.getTakeAllAction(card);
            
            actions.addItem(action);
            actions.addItem(takeAction);
            
            card.actions = actions;
            
            return card;
        }
    
    }

}